package annotation.singleton

import java.util.Date

class SingletonTestG1 {

	// constructor
	private SingletonTestG1() {
		println "init"
		this.initialDate = new Date()
	}

	// instance
	private static SingletonTestG1 instance = null

	// member field
	private initialDate = null

	static  getInstance() {
		if (!instance) {
			synchronized (SingletonTestG1) {
				if (!instance) {
					instance = new SingletonTestG1()
				}

			}
		}
		instance
	}
	// member method
	def getInitialDate() { "Initialize Date: ${initialDate}"}
}
